/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elaborate.tag_analysis.client.ui.model;

import elaborate.tag_analysis.model.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * wrapper of a real Resource instance
 * @author lendle
 */
public class ResourceTreeNode {
    public static final int STATUS_NO_TAGS=-1, STATUS_TAGS=1, STATUS_UNKNOWN=0;
    
    protected Resource resource;
    protected boolean childrenLoaded;
    protected List<ResourceTreeNode> children = new ArrayList<ResourceTreeNode>();
    protected boolean category;
    protected String alt;
    
    protected int status;
    protected boolean statusChecked = false;

    /**
     * Get the value of statusChecked
     *
     * @return the value of statusChecked
     */
    public boolean isStatusChecked() {
        return statusChecked;
    }

    /**
     * Set the value of statusChecked
     *
     * @param statusChecked new value of statusChecked
     */
    public void setStatusChecked(boolean statusChecked) {
        this.statusChecked = statusChecked;
    }


    /**
     * Get the value of status
     *
     * @return the value of status
     */
    public synchronized int getStatus() {
        return status;
    }

    /**
     * Set the value of status
     *
     * @param status new value of status
     */
    public synchronized void setStatus(int status) {
        this.status = status;
    }


    /**
     * Get the value of alt
     *
     * @return the value of alt
     */
    public String getAlt() {
        return alt;
    }

    /**
     * Set the value of alt
     *
     * @param alt new value of alt
     */
    public void setAlt(String alt) {
        this.alt = alt;
    }
    

    /**
     * Get the value of category
     *
     * @return the value of category
     */
    public boolean isCategory() {
        return category;
    }

    /**
     * Set the value of category
     *
     * @param category new value of category
     */
    public void setCategory(boolean category) {
        this.category = category;
    }


    /**
     * Get the value of children
     *
     * @return the value of children
     */
    public List<ResourceTreeNode> getChildren() {
        return children;
    }

    /**
     * Get the value of loaded
     *
     * @return the value of loaded
     */
    public boolean isChildrenLoaded() {
        return childrenLoaded;
    }

    /**
     * Set the value of loaded
     *
     * @param loaded new value of loaded
     */
    public void setChildrenLoaded(boolean loaded) {
        this.childrenLoaded = loaded;
    }


    /**
     * Get the value of resource
     *
     * @return the value of resource
     */
    public Resource getResource() {
        return resource;
    }

    /**
     * Set the value of resource
     *
     * @param resource new value of resource
     */
    public void setResource(Resource resource) {
        this.resource = resource;
    }

    public ResourceTreeNode(Resource resource) {
        this.resource = resource;
    }

    public ResourceTreeNode() {
    }

    
    
    @Override
    public String toString() {
        if(this.alt!=null){
            return this.alt;
        }
        else{
            if(this.resource!=null){
                return resource.getName();
            }
            else{
                return "";
            }
        }
    }

    
}
